package jtalk.model;

import jtalk.controller.Properties;

public class Contact {

	private String name;
	private String group;
	private String nickName;
	private boolean available;
	private String status;
	
	public boolean isAvailable() {
		return available;
	}

	public void setAvailable(boolean available) {
		this.available = available;
	}

	public Contact(String name) {
		this.name = name;
		this.nickName = name.replaceFirst("@.*$", "");
		this.group = "null";
		this.available = false;
		this.status = Properties.STATUS_AVAILABLE.value();
	}
		
	public String getGroup() {
		return group;
	}

	public String getName() {
		return name;
	}
	
	public boolean equals(Object o) {
		if(o.getClass() == Contact.class) {									
			if(((Contact)o).getName().replaceFirst("/.*$", "").equals(this.getName())) {				
				return true;
			}else {								
				return false;
			}
		}else {
			return false;
		}
	}
	
	public String toString() {
		return this.getNickName();
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public final String getStatus() {
		return status;
	}

	public final void setStatus(String status) {
		this.status = status;
	}

	public final void setGroup(String group) {
		this.group = group;
	}
		
}
